package mock

import (
	"github.com/panjf2000/gnet/v2"
)

var Commands = map[string]Desc{
	// strings
	"get": {Proc: Get, Cons: Constraint{2, Flags("rF"), 1, 1, 1}},
	"set": {Proc: Set, Cons: Constraint{-3, Flags("wm"), 1, 1, 1}},

	// keys
	//"type":   Proc: Type, Txn: Type, Cons: Constraint{2, flags("rF"), 1, 1, 1}},
	//"exists": Proc: Exists, Txn: Exists, Cons: Constraint{-2, flags("rF"), 1, -1, 1}},
	"del":    {Proc: Delete, Cons: Constraint{-2, Flags("w"), 1, -1, 1}},
}

type Desc struct {
	// todo 指针
	Proc func(ctx *CmdContext, s *Store) []byte
	Cons Constraint
}

type CmdContext struct {
	Name string
	Args [][]byte
	Conn gnet.Conn
}
